home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Online / Apache / include / apache / ap_config.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-06  |  38.2 KB  |  1,506 lines

  1. /* ====================================================================
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 2000 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Apache" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation.  For more
  51.  * information on the Apache Software Foundation, please see
  52.  * <http://www.apache.org/>.
  53.  *
  54.  * Portions of this software are based upon public domain software
  55.  * originally written at the National Center for Supercomputing Applications,
  56.  * University of Illinois, Urbana-Champaign.
  57.  */
  58.  
  59. #ifndef AP_CONFIG_H
  60. #define AP_CONFIG_H
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. /*
  67.  * ap_config.h: system-dependant #defines and includes...
  68.  * See PORTING for a listing of what they mean
  69.  */
  70.  
  71. #include "ap_mmn.h"        /* MODULE_MAGIC_NUMBER_ */
  72.  
  73. /*
  74.  * Support for platform dependent autogenerated defines
  75.  */
  76. #if !defined(WIN32) && !defined(NETWARE)
  77. #include "ap_config_auto.h"
  78. #else
  79. /* not available under WIN32, so provide important entries manually */
  80. #undef HAVE_UNISTD_H
  81. #endif
  82.  
  83. /* Have to include sys/stat.h before ../win32/os.h so we can override
  84. stat() properly */
  85. #ifndef NETWARE
  86. #include <sys/types.h>
  87. #endif
  88. #include <sys/stat.h>
  89.  
  90.  
  91. /* So that we can use inline on some critical functions, and use
  92.  * GNUC attributes (such as to get -Wall warnings for printf-like
  93.  * functions).  Only do this in gcc 2.7 or later ... it may work
  94.  * on earlier stuff, but why chance it.
  95.  *
  96.  * We've since discovered that the gcc shipped with NeXT systems
  97.  * as "cc" is completely broken.  It claims to be __GNUC__ and so
  98.  * on, but it doesn't implement half of the things that __GNUC__
  99.  * means.  In particular it's missing inline and the __attribute__
  100.  * stuff.  So we hack around it.  PR#1613. -djg
  101.  */
  102. #if !defined(__GNUC__) || __GNUC__ < 2 || \
  103.     (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
  104.     defined(NEXT)
  105. #define ap_inline
  106. #define __attribute__(__x)
  107. #define ENUM_BITFIELD(e,n,w)  signed int n : w
  108. #else
  109. #define ap_inline __inline__
  110. #define USE_GNU_INLINE
  111. #define ENUM_BITFIELD(e,n,w)  e n : w
  112. #endif
  113.  
  114. #include "os.h"
  115.  
  116. /* Define one of these according to your system. */
  117. #if defined(MINT)
  118. typedef int rlim_t;
  119. #define JMP_BUF sigjmp_buf
  120. #define NO_LONG_DOUBLE
  121. #define USE_FLOCK_SERIALIZED_ACCEPT
  122. #define _BSD_SOURCE
  123. #define EAGAIN EWOULDBLOCK
  124. int initgroups (char *, int);     
  125. char *crypt (const char *pw, const char *salt);
  126. int gethostname (char *name, int namelen);
  127.  
  128. #elif defined(MPE)
  129. #include <sys/times.h>
  130. #define NO_SETSID
  131. #define NO_KILLPG
  132. #define NO_WRITEV
  133. #define HAVE_SHMGET 1
  134. #define USE_SHMGET_SCOREBOARD
  135. /* 
  136.    UID/GID isn't a native concept for MPE, and it's definitely not a 100%
  137.    Unix implementation.  There isn't a traditional superuser concept either,
  138.    so we're forced to liberalize SHM security a bit so the parent & children
  139.    can communicate when they're running with different UIDs within the same
  140.    GID (the GID will *always* be the same on MPE).  Thus the weird SHM_R and
  141.    SHM_W below.
  142. */
  143. #define SHM_R 0440  /* Read permission */
  144. #define SHM_W 0220  /* Write permission */
  145. #define NEED_INITGROUPS
  146. #define NEED_STRCASECMP
  147. #define NEED_STRDUP
  148. #define NEED_STRNCASECMP
  149. extern void GETPRIVMODE();
  150. extern void GETUSERMODE();
  151. extern char *inet_ntoa();
  152. #define NO_SLACK
  153. #define S_IEXEC  S_IXUSR
  154. #define S_IREAD  S_IRUSR
  155. #define S_IWRITE S_IWUSR
  156. #define PF_INET  AF_INET
  157. #define USE_FCNTL_SERIALIZED_ACCEPT
  158.  
  159. #elif defined(SUNOS4)
  160. #define HAVE_GMTOFF 1
  161. #undef NO_KILLPG
  162. #undef NO_SETSID
  163. char *crypt(const char *pw, const char *salt);
  164. char *mktemp(char *);
  165. #define HAVE_MMAP 1
  166. #define USE_MMAP_SCOREBOARD
  167. #define USE_MMAP_FILES
  168. #include <sys/time.h>
  169. #define NEED_STRERROR
  170. typedef int rlim_t;
  171. #define memmove(a,b,c) bcopy(b,a,c)
  172. #define NO_LINGCLOSE
  173. #define USE_FLOCK_SERIALIZED_ACCEPT
  174. #define NEED_DIFFTIME
  175. #define HAVE_SYSLOG 1
  176.  
  177. #elif defined(SOLARIS2)
  178. #undef HAVE_GMTOFF
  179. #define NO_KILLPG
  180. #undef NO_SETSID
  181. #define bzero(a,b) memset(a,0,b)
  182. #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
  183.     !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
  184. #define USE_FCNTL_SERIALIZED_ACCEPT
  185. #endif
  186. #define NEED_UNION_SEMUN
  187. #define HAVE_MMAP 1
  188. #define USE_MMAP_SCOREBOARD
  189. #define USE_MMAP_FILES
  190. int gethostname(char *name, int namelen);
  191. #define HAVE_SYSLOG 1
  192. #define SYS_SIGLIST _sys_siglist
  193.  
  194. #elif defined(IRIX)
  195. #undef HAVE_GMTOFF
  196. /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
  197.  * there's some weird conflict with non-BSD signals */
  198. #define NO_KILLPG
  199. #undef NO_SETSID
  200. #if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \
  201.     !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \
  202.     !defined(USE_SYSVSEM_SERIALIZED_ACCEPT)
  203. #define USE_FCNTL_SERIALIZED_ACCEPT
  204. #endif
  205. #define HAVE_SHMGET 1
  206. #define USE_SHMGET_SCOREBOARD
  207. #define HAVE_MMAP 1
  208. #define USE_MMAP_FILES
  209. #define NO_LONG_DOUBLE
  210. #define NO_LINGCLOSE
  211. #define HAVE_SYSLOG 1
  212.  
  213. #elif defined(HIUX)
  214. #undef HAVE_GMTOFF
  215. #define NO_KILLPG
  216. #undef NO_SETSID
  217. #ifndef _HIUX_SOURCE
  218. #define _HIUX_SOURCE
  219. #endif
  220. #define HAVE_SHMGET 1
  221. #define USE_SHMGET_SCOREBOARD
  222. #define SELECT_NEEDS_CAST
  223. #define HAVE_SYSLOG 1
  224.  
  225. #elif defined(HPUX) || defined(HPUX10)
  226. #undef HAVE_GMTOFF
  227. #define NO_KILLPG
  228. #undef NO_SETSID
  229. #define USE_FCNTL_SERIALIZED_ACCEPT
  230. #ifndef _HPUX_SOURCE
  231. #define _HPUX_SOURCE
  232. #endif
  233. #define HAVE_SHMGET 1
  234. #define USE_SHMGET_SCOREBOARD
  235. #define HAVE_SYSLOG 1
  236. #ifndef HPUX10
  237. #define SELECT_NEEDS_CAST
  238. typedef int rlim_t;
  239. #endif
  240.  
  241. #elif defined(HPUX11)
  242. #ifndef _HPUX_SOURCE
  243. #define _HPUX_SOURCE
  244. #endif
  245. #define HAVE_SHMGET
  246. #define USE_SHMGET_SCOREBOARD
  247. #undef  HAVE_GMTOFF
  248. #define USE_FCNTL_SERIALIZED_ACCEPT
  249. /* feeling brave?  want to try using POSIX mutexes? */
  250. /* #define HAVE_MMAP */
  251. /* #define USE_MMAP_SCOREBOARD */
  252. /* #define USE_MMAP_FILES */
  253. /* #define USE_PTHREAD_SERIALIZED_ACCEPT */
  254. #define NO_KILLPG
  255. #undef  NO_SETSID
  256. #define HAVE_SYSLOG
  257.  
  258. #elif defined(AIX)
  259. #undef HAVE_GMTOFF
  260. #undef NO_KILLPG
  261. #undef NO_SETSID
  262. #ifndef __ps2__
  263. #define HAVE_MMAP 1
  264. #define USE_MMAP_SCOREBOARD
  265. #define USE_MMAP_FILES
  266. #define HAVE_SYSLOG 1
  267. #ifndef DEFAULT_GROUP
  268. #define DEFAULT_GROUP "nobody"
  269. #endif
  270. #endif
  271. #ifndef DEFAULT_USER
  272. #define DEFAULT_USER "nobody"
  273. #endif
  274. #ifdef NEED_RLIM_T
  275. typedef int rlim_t;
  276. #endif
  277. #if !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
  278. #define USE_FCNTL_SERIALIZED_ACCEPT
  279. #endif
  280. #ifdef USEBCOPY
  281. #define memmove(a,b,c) bcopy(b,a,c)
  282. #endif
  283. #if AIX >= 42
  284. #define NET_SIZE_T size_t
  285. #endif
  286.  
  287. #elif defined(AMIGA)
  288. #define _INLINE_EXEC_H
  289. #define Debug AmigaDebug
  290. #include <proto/exec.h>
  291. #undef Debug
  292. #undef _INLINE_EXEC_H
  293. #include <inline/exec.h>
  294. #undef Debug
  295. #include <dos/var.h>
  296. #include <proto/dos.h>
  297. #include <dos/dosextens.h>
  298. #include <exec/ports.h>
  299. #include <proto/dos.h>
  300. #define HAVE_SHMGET
  301. #define USE_SHMGET_SCOREBOARD
  302. #define HAVE_GMTOFF
  303. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  304. #define NO_KILLPG
  305. #define NO_SETSID
  306. #define JMP_BUF sigjmp_buf
  307. #undef NO_LINGCLOSE
  308. #define NO_SLACK
  309. #define HAVE_SYSLOG
  310. #define SHM_R IPC_R
  311. #define SHM_W IPC_W
  312. #define SHM_M IPC_M
  313. #define CHILD_ENV_VARIABLE "CHILD_NUMBER"
  314. #define ACCEPT_CHILD_NUMBER 0 /* child number which does the accepting > 0 does a getmsg */
  315. #define ix_wait(pmask) ix_select(0, NULL, NULL, NULL, NULL, pmask)
  316. #include <sys/socket.h>
  317. struct ChildMsg {
  318.     struct Message msg;
  319.     long id;
  320.     int inet;
  321.     int stream;
  322.     int protocol;
  323.     time_t restart_time; /* useful in server status */
  324.     struct sockaddr sa_client;
  325. };
  326. #elif defined(ULTRIX)
  327. /* we don't want to use sys/resource.h under
  328.    Ultrix although this header exists. */
  329. #undef HAVE_SYS_RESOURCE_H
  330. #define HAVE_GMTOFF 1
  331. #undef NO_KILLPG
  332. #undef NO_SETSID
  333. #define ULTRIX_BRAIN_DEATH
  334. #define NEED_STRDUP
  335. /* If you have Ultrix 4.3, and are using cc, const is broken */
  336. #ifndef __ultrix__        /* Hack to check for pre-Ultrix 4.4 cc */
  337. #define const            /* Not implemented */
  338. #endif
  339.  
  340. #elif defined(OSF1)
  341. #define HAVE_GMTOFF 1
  342. #undef NO_KILLPG
  343. #undef NO_SETSID
  344. #define HAVE_MMAP 1
  345. #define USE_MMAP_SCOREBOARD
  346. #define USE_MMAP_FILES
  347. #define NO_LONG_DOUBLE
  348. #define HAVE_SYSLOG 1
  349. #define USE_FLOCK_SERIALIZED_ACCEPT
  350. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  351.  
  352. #elif defined(PARAGON)
  353. #define HAVE_GMTOFF 1
  354. #undef NO_KILLPG
  355. #undef NO_SETSID
  356. #define HAVE_MMAP 1
  357. #define USE_MMAP_SCOREBOARD
  358. #define USE_MMAP_FILES
  359. #define NO_LONG_DOUBLE
  360. #define HAVE_SYSLOG 1
  361. typedef int rlim_t;
  362.  
  363. #elif defined(SEQUENT)
  364. #define DEFAULT_USER "nobody"
  365. #define DEFAULT_GROUP "nobody"
  366. #define NO_SHMGET 1
  367. #define HAVE_MMAP 1
  368. #define HAVE_SYSLOG 1
  369. #define USE_MMAP_FILES 1
  370. #define USE_MMAP_SCOREBOARD 1
  371. #define USE_FCNTL_SERIALIZED_ACCEPT 1
  372. #define JMP_BUF sigjmp_buf
  373. #undef NO_SETSID
  374. #if SEQUENT < 40
  375. typedef int rlim_t;
  376. #define NO_GETTIMEOFDAY
  377. #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
  378. #include <sys/times.h>
  379. #endif
  380. #if SEQUENT < 42
  381. #define NEED_STRCASECMP
  382. #define NEED_STRNCASECMP
  383. #endif
  384. #if SEQUENT < 44
  385. #define NO_KILLPG 1
  386. #define NET_SIZE_T int
  387. #endif
  388. #if SEQUENT >= 44
  389. #undef NO_KILLPG
  390. #define NET_SIZE_T size_t
  391. #endif
  392.  
  393. #elif defined(NEXT)
  394. typedef unsigned short mode_t;
  395. typedef int rlim_t;
  396. #define HAVE_GMTOFF 1
  397. #undef NO_KILLPG
  398. #define NO_SETSID
  399. #define NEED_STRDUP
  400. #define NO_LINGCLOSE
  401. #undef _POSIX_SOURCE
  402. #ifndef FD_CLOEXEC
  403. #define FD_CLOEXEC 1
  404. #endif
  405. #ifndef S_ISDIR
  406. #define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
  407. #endif
  408. #ifndef S_ISREG
  409. #define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
  410. #endif
  411. #ifndef S_IXUSR
  412. #define S_IXUSR 00100
  413. #endif
  414. #ifndef S_IRGRP
  415. #define S_IRGRP 00040
  416. #endif
  417. #ifndef S_IXGRP
  418. #define S_IXGRP 00010
  419. #endif
  420. #ifndef S_IROTH
  421. #define S_IROTH 00004
  422. #endif
  423. #ifndef S_IXOTH
  424. #define S_IXOTH 00001
  425. #endif
  426. #ifndef S_IRUSR
  427. #define S_IRUSR S_IREAD
  428. #endif
  429. #ifndef S_IWUSR
  430. #define S_IWUSR S_IWRITE
  431. #endif
  432. #ifndef S_IWGRP
  433. #define S_IWGRP    000020
  434. #endif
  435. #ifndef S_IWOTH
  436. #define S_IWOTH 000002
  437. #endif
  438.  
  439. #define STDIN_FILENO  0
  440. #define STDOUT_FILENO 1
  441. #define STDERR_FILENO 2
  442.  
  443. /* PR#2293 fix */
  444. #define    ap_wait_t    union wait
  445. #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
  446. #define WEXITSTATUS(status)     (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
  447. #define WTERMSIG(status)    (int)( (status).w_termsig )
  448.  
  449. typedef int pid_t;
  450. #define USE_LONGJMP
  451. #define NO_USE_SIGACTION
  452. #define HAVE_SYSLOG 1
  453.  
  454. #if defined(__DYNAMIC__)
  455. #define HAVE_DYLD
  456. #define DYLD_CANT_UNLOAD
  457. #endif
  458.  
  459. #elif defined(DARWIN) /* Darwin (Mac OS) */
  460. #undef PLATFORM
  461. #define PLATFORM "Darwin"
  462. #define HAVE_DYLD
  463. #define HAVE_GMTOFF
  464. #define HAVE_MMAP
  465. #define USE_MMAP_FILES
  466. #define USE_MMAP_SCOREBOARD
  467. #ifdef MAC_OS_X_SERVER
  468. #define MAP_TMPFILE
  469. #endif /* MAC_OS_X_SERVER */
  470. #define HAVE_RESOURCE
  471. #define HAVE_SNPRINTF
  472. #define JMP_BUF jmp_buf
  473. #define USE_LONGJMP
  474. #define USE_FLOCK_SERIALIZED_ACCEPT
  475. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  476. /*
  477.  * If you are using APACI, (you probably should be on Mac OS) these
  478.  * values are set at configure time.
  479.  */
  480. #ifndef HTTPD_ROOT
  481. #define HTTPD_ROOT              "/Local/Library/WebServer"
  482. #endif
  483. #ifndef DOCUMENT_LOCATION
  484. #define DOCUMENT_LOCATION       HTTPD_ROOT "/Documents"
  485. #endif
  486. #ifndef DEFAULT_XFERLOG
  487. #define DEFAULT_XFERLOG         "Logs/Access"
  488. #endif
  489. #ifndef DEFAULT_ERRORLOG
  490. #define DEFAULT_ERRORLOG        "Logs/Errors"
  491. #endif
  492. #ifndef DEFAULT_PIDLOG
  493. #define DEFAULT_PIDLOG          "Logs/Process"
  494. #endif
  495. #ifndef DEFAULT_SCOREBOARD
  496. #define DEFAULT_SCOREBOARD      "Logs/Status"
  497. #endif
  498. #ifndef DEFAULT_LOCKFILE
  499. #define DEFAULT_LOCKFILE        "Logs/Lock"
  500. #endif
  501. #ifndef SERVER_CONFIG_FILE
  502. #define SERVER_CONFIG_FILE      "Configuration/Server"
  503. #endif
  504. #ifndef RESOURCE_CONFIG_FILE
  505. #define RESOURCE_CONFIG_FILE    "Configuration/Resources"
  506. #endif
  507. #ifndef TYPES_CONFIG_FILE
  508. #define TYPES_CONFIG_FILE       "Configuration/MIME"
  509. #endif
  510. #ifndef ACCESS_CONFIG_FILE
  511. #define ACCESS_CONFIG_FILE      "Configuration/Access"
  512. #endif
  513. #ifndef DEFAULT_USER_DIR
  514. #define DEFAULT_USER_DIR        "Library/Web Documents"
  515. #endif
  516. #ifndef DEFAULT_USER
  517. #define DEFAULT_USER            "www"
  518. #endif
  519. #ifndef DEFAULT_GROUP
  520. #define DEFAULT_GROUP           "www"
  521. #endif
  522. #ifndef DEFAULT_PATH
  523. #define DEFAULT_PATH            "/bin:/usr/bin:/usr/local/bin"
  524. #endif
  525.  
  526. #elif defined(LINUX)
  527.  
  528. #if LINUX > 1
  529. #include <features.h>
  530.  
  531. /* libc4 systems probably still work, it probably doesn't define
  532.  *  __GNU_LIBRARY__
  533.  * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
  534.  * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
  535.  * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
  536.  * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
  537.  * __GLIBC__ < 2
  538.  * all glibc based systems need crypt.h
  539.  */
  540. #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
  541. #include <crypt.h>
  542. #endif
  543.  
  544. /* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
  545.  * there's no way to discern between these two libraries.  But using int should
  546.  * be portable because otherwise these libs would be hopelessly broken with
  547.  * reams of existing networking code.  We'll use socklen_t * for 2.1.x and
  548.  * later.
  549.  *
  550.  * int works for all the earlier libs, and is picked up by default later.
  551.  */
  552. #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
  553. #define NET_SIZE_T socklen_t
  554. #endif
  555.  
  556. #define HAVE_SHMGET 1
  557. #define USE_SHMGET_SCOREBOARD
  558. #define HAVE_MMAP 1
  559. #define USE_MMAP_FILES
  560.  
  561. #if LINUX > 20
  562. /* see Pine.LNX.4.21.0011041233550.1897-100000@twinlark.arctic.org
  563.  * in new-httpd archives for performance numbers indicating these
  564.  * are the right choices for linux 2.2.x and later
  565.  */
  566. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  567. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
  568. #include <sys/sem.h>
  569. #if _SEM_SEMUN_UNDEFINED
  570. #define NEED_UNION_SEMUN
  571. #endif
  572. #else
  573. #define USE_FCNTL_SERIALIZED_ACCEPT
  574. #endif
  575.  
  576. #define SYS_SIGLIST    _sys_siglist
  577.  
  578. #else
  579. #define USE_FCNTL_SERIALIZED_ACCEPT
  580. #endif
  581.  
  582. #undef HAVE_GMTOFF
  583. #undef NO_KILLPG
  584. #undef NO_SETSID
  585. #undef NEED_STRDUP
  586. #include <sys/time.h>
  587. #define HAVE_SYSLOG 1
  588.  
  589. /* glibc 2.1 and later finally define rlim_t */
  590. #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
  591. typedef int rlim_t;
  592. #endif
  593.  
  594. #elif defined(SCO)
  595. #undef HAVE_GMTOFF
  596. #undef NO_KILLPG
  597. #undef NO_SETSID
  598. #define NEED_INITGROUPS
  599. #define NO_WRITEV
  600. #include <sys/time.h>
  601. #define HAVE_SYSLOG 1
  602. #undef HAVE_SYS_RESOURCE_H
  603.  
  604. #elif defined(SCO5)
  605.  
  606. #define USE_FCNTL_SERIALIZED_ACCEPT
  607. #define HAVE_MMAP 1
  608. #define USE_MMAP_SCOREBOARD
  609. #define USE_MMAP_FILES
  610. #define SecureWare
  611. #define HAVE_SYSLOG 1
  612.  
  613. /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
  614.    consts. Sigh. */
  615. extern int strcasecmp(const char *, const char *);
  616. extern int strncasecmp(const char *, const char *, unsigned);
  617.  
  618. #elif defined(AUX3)
  619. /* These are to let -Wall compile more cleanly */
  620. extern int strcasecmp(const char *, const char *);
  621. extern int strncasecmp(const char *, const char *, unsigned);
  622. extern int set42sig(), getopt(), getpeername(), bzero();
  623. extern int listen(), bind(), socket(), getsockname();
  624. extern int accept(), gethostname(), connect(), lstat();
  625. extern int select(), killpg(), shutdown();
  626. extern int initgroups(), setsockopt();
  627. extern char *shmat();
  628. extern int shmctl();
  629. extern int shmget();
  630. extern char *sbrk();
  631. extern char *crypt();
  632. #include <sys/time.h>
  633. #undef HAVE_GMTOFF
  634. #undef NO_KILLPG
  635. #undef NO_SETSID
  636. #define NEED_STRDUP
  637. /* fcntl() locking is expensive with NFS */
  638. #define USE_FLOCK_SERIALIZED_ACCEPT
  639. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  640. #define HAVE_SHMGET 1
  641. #define USE_SHMGET_SCOREBOARD
  642. /*
  643.  * NOTE: If when you run Apache under A/UX and you get a warning
  644.  * that httpd couldn't move break, then the below value for
  645.  * MOVEBREAK (64megs) is too large for your setup. Try reducing
  646.  * to 0x2000000 which is still PLENTY of space. I doubt if
  647.  * even on heavy systems sbrk() would be called at all...
  648.  */
  649. #define MOVEBREAK        0x4000000
  650. #define NO_LINGCLOSE
  651. #define NO_SLACK
  652. #define HAVE_SYSLOG 1
  653. #undef HAVE_SYS_RESOURCE_H    /* exists but does not provide *rlimit funcs */
  654.  
  655. #elif defined(SVR4)
  656. #define NO_KILLPG
  657. #undef  NO_SETSID
  658. #undef NEED_STRDUP
  659. #ifndef MPRAS
  660. #define NEED_STRCASECMP
  661. #ifndef ENCORE
  662. #define NEED_STRNCASECMP
  663. #endif /* ENCORE */
  664. #endif /* MPRAS */
  665. #define bzero(a,b) memset(a,0,b)
  666. /* A lot of SVR4 systems need this */
  667. #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT
  668. #define USE_FCNTL_SERIALIZED_ACCEPT
  669. #endif
  670. #define HAVE_SYSLOG 1
  671. #define NET_SIZE_T size_t
  672. #define HAVE_SHMGET 1
  673. #define USE_SHMGET_SCOREBOARD
  674. #ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */
  675. #define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */
  676. #define _KMEMUSER          /* Enable SHM_R/SHM_W defines in <shm.h> */
  677. #undef NEED_STRCASECMP
  678. #undef NEED_STRNCASECMP
  679. #undef bzero
  680. #endif /*_OSD_POSIX*/
  681.  
  682. #elif defined(UW)
  683. #if UW < 700
  684. #define USE_FCNTL_SERIALIZED_ACCEPT
  685. #define NO_LINGCLOSE
  686. #define NO_KILLPG
  687. #endif
  688. #undef  NO_SETSID
  689. #undef NEED_STRDUP
  690. #define NEED_STRCASECMP
  691. #define NEED_STRNCASECMP
  692. #define bzero(a,b) memset(a,0,b)
  693. #define HAVE_MMAP 1
  694. #define USE_MMAP_SCOREBOARD
  695. #define USE_MMAP_FILES
  696. #define HAVE_SHMGET 1
  697. #undef USE_SHMGET_SCOREBOARD    /* force use of mmap() scoreboard */
  698. #include <sys/time.h>
  699. #if UW >= 200
  700. #define _POSIX_SOURCE
  701. #endif
  702. #define NET_SIZE_T size_t
  703. #define HAVE_SYSLOG 1
  704.  
  705. #elif defined(DGUX)
  706. #define NO_KILLPG
  707. #undef  NO_SETSID
  708. #undef NEED_STRDUP
  709. #ifdef _IX86_DG
  710. #undef NEED_STRCASECMP
  711. #undef NEED_STRNCASECMP
  712. #else
  713. #define NEED_STRCASECMP
  714. #define NEED_STRNCASECMP
  715. #endif
  716. #define bzero(a,b) memset(a,0,b)
  717. /* A lot of SVR4 systems need this */
  718. #define USE_FCNTL_SERIALIZED_ACCEPT
  719. #define ap_inet_addr inet_network
  720. #define HAVE_SYSLOG 1
  721.  
  722. #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
  723. #define HAVE_GMTOFF 1
  724. #undef NO_KILLPG
  725. #undef NO_SETSID
  726. #define HAVE_SYSLOG 1
  727. #ifndef DEFAULT_USER
  728. #define DEFAULT_USER "nobody"
  729. #endif
  730. #ifndef DEFAULT_GROUP
  731. #define DEFAULT_GROUP "nogroup"
  732. #endif
  733. #define HAVE_SHMGET 1
  734. #define HAVE_MMAP 1
  735. #define USE_MMAP_SCOREBOARD
  736. #define USE_MMAP_FILES
  737. #define USE_FLOCK_SERIALIZED_ACCEPT
  738. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  739.  
  740. #elif defined(UTS21)
  741. #undef HAVE_GMTOFF
  742. #undef NO_KILLPG
  743. #define NO_SETSID
  744. #define NEED_WAITPID
  745. #define STDIN_FILENO 0
  746. #define STDOUT_FILENO 1
  747. #define STDERR_FILENO 2
  748. #define HAVE_SYSLOG 1
  749. #define USE_LONGJMP
  750. #define JMP_BUF jmp_buf
  751. #define NO_USE_SIGACTION
  752. #define NEED_STRERROR
  753. #define NEED_STRSTR
  754. #define NEED_HASHBANG_EMUL
  755. #define NDELAY_PIPE_RETURNS_ZERO
  756. #define NO_DATA NO_ADDRESS
  757. #define    ap_wait_t        union wait
  758. #define WEXITSTATUS(status)    (int)((status).w_retcode)
  759. #define WTERMSIG(status)    (int)((status).w_termsig)
  760. #define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
  761. #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
  762. #include <sys/types.h>
  763. #include <sys/time.h>     
  764.  
  765. #elif defined(APOLLO)
  766. #undef HAVE_GMTOFF
  767. #undef NO_KILLPG
  768. #undef NO_SETSID
  769. #define HAVE_SYSLOG 1
  770.  
  771. #elif defined(__FreeBSD__) || defined(__bsdi__)
  772. #if defined(__FreeBSD__)
  773. #include <osreldate.h>
  774. #endif
  775. #define HAVE_GMTOFF 1
  776. #undef NO_KILLPG
  777. #undef NO_SETSID
  778. #define HAVE_MMAP 1
  779. #define USE_MMAP_SCOREBOARD
  780. #define USE_MMAP_FILES
  781. #ifndef DEFAULT_USER
  782. #define DEFAULT_USER "nobody"
  783. #endif
  784. #ifndef DEFAULT_GROUP
  785. #define DEFAULT_GROUP "nogroup"
  786. #endif
  787. #if defined(__bsdi__) || \
  788. (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
  789. typedef quad_t rlim_t;
  790. #endif
  791. #define USE_FLOCK_SERIALIZED_ACCEPT
  792. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  793. #define HAVE_SYSLOG 1
  794. #define SYS_SIGLIST sys_siglist
  795. #if (defined(__FreeBSD_version) && (__FreeBSD_version >= 400000))
  796. #define NET_SIZE_T socklen_t
  797. #endif
  798.  
  799. #elif defined(QNX)
  800. #ifndef crypt
  801. char *crypt(const char *pw, const char *salt);
  802. #endif
  803. #ifndef initgroups
  804. int initgroups(char *, int);
  805. #endif
  806. #ifndef strncasecmp
  807. #define strncasecmp strnicmp
  808. #endif
  809. #undef NO_KILLPG
  810. #undef NO_SETSID
  811. #define NEED_INITGROUPS
  812. #define NEED_SELECT_H
  813. #define NEED_PROCESS_H
  814. #include <unix.h>
  815. #define HAVE_MMAP 1
  816. #define USE_POSIX_SCOREBOARD
  817. #define USE_FLOCK_SERIALIZED_ACCEPT
  818. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  819. #define HAVE_SYSLOG 1
  820.  
  821. #elif defined(LYNXOS)
  822. #undef HAVE_GMTOFF
  823. #undef USE_MMAP_SCOREBOARD
  824. #undef USE_SHMGET_SCOREBOARD
  825. #undef USE_FCNTL_SERIALIZED_ACCEPT
  826. #undef USE_FLOCK_SERIALIZED_ACCEPT
  827. #define USE_LONGJMP
  828. #undef NO_KILLPG
  829. #undef NO_SETSID
  830. #undef NO_USE_SIGACTION
  831. #undef NO_LINGCLOSE
  832. extern char *crypt(char *pw, char *salt);
  833. typedef int rlim_t;
  834. #define HAVE_SYSLOG 1
  835.  
  836. #elif defined(UXPDS)
  837. #undef NEED_STRCASECMP
  838. #undef NEED_STRNCASECMP
  839. #undef NEED_STRDUP
  840. #undef HAVE_GMTOFF
  841. #define NO_KILLPG
  842. #undef NO_SETSID
  843. #define bzero(a,b) memset(a,0,b)
  844. #define USE_FCNTL_SERIALIZED_ACCEPT
  845. #define HAVE_MMAP 1
  846. #define USE_MMAP_SCOREBOARD
  847. #define USE_MMAP_FILES
  848. #define HAVE_SYSLOG 1
  849.  
  850. #elif defined(OS2)
  851. /* Defines required for EMX OS/2 port. */
  852. #define NO_KILLPG
  853. #define NEED_STRCASECMP
  854. #define NEED_STRNCASECMP
  855. #define NEED_PROCESS_H
  856. #define NO_SETSID
  857. #define NO_TIMES
  858. #define CASE_BLIND_FILESYSTEM
  859. /* Add some drive name support */
  860. #define chdir _chdir2
  861. #include <sys/time.h>
  862. #define MAXSOCKETS 2048
  863. #define USE_OS2_SCOREBOARD
  864. #define NO_RELIABLE_PIPED_LOGS
  865. #define USE_OS2SEM_SERIALIZED_ACCEPT
  866. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  867. #define NO_SLACK
  868. #define FOPEN_REQUIRES_T
  869.  
  870. #elif defined(__MACHTEN__)
  871. typedef int rlim_t;
  872. #undef NO_KILLPG
  873. #define NO_SETSID
  874. #define HAVE_GMTOFF 1
  875. #ifndef __MACHTEN_PPC__
  876. #ifndef __MACHTEN_68K__
  877. #define __MACHTEN_68K__
  878. #endif
  879. #define USE_FLOCK_SERIALIZED_ACCEPT
  880. #define NO_USE_SIGACTION
  881. #define JMP_BUF sigjmp_buf
  882. #define USE_LONGJMP
  883. #undef NEED_STRDUP
  884. #else
  885. #define HAVE_SHMGET 1
  886. #define USE_SHMGET_SCOREBOARD
  887. #define USE_FCNTL_SERIALIZED_ACCEPT
  888. #endif
  889.  
  890. /* Convex OS v11 */
  891. #elif defined(CONVEXOS11)
  892. #undef HAVE_GMTOFF
  893. #undef NO_KILLPG
  894. #undef NO_SETSID
  895. #undef NEED_STRDUP
  896. #define HAVE_MMAP 1
  897. #define USE_MMAP_SCOREBOARD
  898. #define USE_MMAP_FILES
  899. #define HAVE_SYSLOG 1
  900.  
  901. #define NO_TIMEZONE
  902. #include <stdio.h>
  903. #include <sys/types.h>
  904. typedef int rlim_t;
  905.  
  906. #elif defined(ISC)
  907. #include <net/errno.h>
  908. #define NO_KILLPG
  909. #undef NO_SETSID
  910. #define HAVE_SHMGET 1
  911. #define USE_SHMGET_SCOREBOARD
  912. #define USE_FCNTL_SERIALIZED_ACCEPT
  913. #define HAVE_SYSLOG 1
  914.  
  915. #elif defined(NEWSOS)
  916. #define HAVE_SHMGET 1
  917. #define USE_SHMGET_SCOREBOARD
  918. #define USE_LONGJMP
  919. #define NO_SETSID
  920. #define NO_USE_SIGACTION
  921. #define NEED_WAITPID
  922. #define NO_OTHER_CHILD
  923. #define HAVE_SYSLOG 1
  924. #include <sys/time.h>
  925. #include <stdlib.h>
  926. #include <sys/types.h>
  927. typedef int pid_t;
  928. typedef int rlim_t;
  929. typedef int mode_t;
  930.  
  931. #elif defined(RISCIX)
  932. #include <sys/time.h>
  933. typedef int rlim_t;
  934. #define NO_USE_SIGACTION
  935. #define USE_LONGJMP
  936. #define NEED_STRCASECMP
  937. #define NEED_STRNCASECMP
  938. #define NEED_STRDUP
  939.  
  940. #elif defined(BEOS)
  941. #undef PLATFORM
  942. #define PLATFORM "BeOS"
  943. #include <stddef.h>
  944.  
  945. #define NO_WRITEV
  946. #define NO_KILLPG
  947. #define NEED_INITGROUPS
  948. #define PF_INET AF_INET
  949. #define S_IEXEC S_IXUSR
  950.  
  951. #elif defined(BONE)
  952. #undef PLATFORM
  953. #define PLATFORM "BeOS BONE"
  954. #define NO_KILLPG
  955. #define NEED_INITGROUPS
  956. #define S_IEXEC S_IXUSR
  957.  
  958. #elif defined(_CX_SX)
  959. #define JMP_BUF sigjmp_buf
  960. #include <sys/types.h>
  961. #include <sys/time.h>
  962.  
  963. #elif defined(WIN32)
  964.  
  965. /* All windows stuff is now in os/win32/os.h */
  966.  
  967. #elif defined(TPF) /* IBM Transaction Processing Facility operating system */
  968.  
  969. #include <tpfeq.h>
  970. #include <tpfio.h>
  971. #include <sysapi.h>
  972. #include <sysgtime.h>
  973. #define PRIMECRAS 0x010000
  974. #define JMP_BUF jmp_buf
  975. #define HAVE_SHMGET
  976. #undef  HAVE_SYS_RESOURCE_H
  977. #define NEED_INITGROUPS
  978. #define NEED_SIGNAL_INTERRUPT
  979. #include <strings.h>
  980. #ifndef __strings_h
  981. #define NEED_STRCASECMP
  982. #define NEED_STRNCASECMP
  983. #endif
  984. #define NEED_STRDUP
  985. #define NO_DBM_REWRITEMAP
  986. #define NO_GETTIMEOFDAY
  987. #define NO_LINGCLOSE
  988. #define NO_MMAP
  989. #define NO_OTHER_CHILD
  990. #define NO_PIPED_LOGS
  991. #define NO_RELIABLE_PIPED_LOGS
  992. #define NO_SETSID
  993. #define NO_SLACK
  994. #define NO_TIMES
  995. #define NO_USE_SIGACTION
  996. #define USE_LONGJMP
  997. #define USE_SHMGET_SCOREBOARD
  998. /*#define USE_TPF_SCOREBOARD*/
  999. #define USE_TPF_ACCEPT
  1000. #define USE_TPF_CORE_SERIALIZED_ACCEPT
  1001. #define USE_TPF_SELECT
  1002. #define S_IREAD S_IRUSR
  1003. #define S_IWRITE S_IWUSR
  1004. #define S_IEXEC S_IXUSR
  1005. #define crypt(buf,salt) ((char *)buf)
  1006. #undef  offsetof
  1007. #define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
  1008.  
  1009. #elif defined(__TANDEM)
  1010. #define NO_WRITEV
  1011. #define NO_KILLPG
  1012. #define NEED_INITGROUPS
  1013. #define NO_SLACK
  1014.  
  1015. #elif defined(OS390)                /* IBM OS/390 Operating System      */
  1016. #define HAVE_MMAP
  1017. #define HAVE_SHMGET
  1018. #define USE_SHMGET_SCOREBOARD
  1019. #define USE_MMAP_FILES
  1020. #define NEED_UNION_SEMUN
  1021. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  1022. #define _POSIX_SOURCE
  1023. #include <signal.h>
  1024. #ifdef SIGDUMP  /* SIGDUMP is not defined by OS/390 v1r2 */
  1025. #define NSIG SIGDUMP+1
  1026. #else
  1027. #define NSIG 40
  1028. #endif
  1029. #define JMP_BUF sigjmp_buf
  1030. #define _XOPEN_SOURCE_EXTENDED 1
  1031. #define _OPEN_MSGQ_EXT
  1032. #define _XOPEN_SOURCE
  1033. #define SHM_R S_IRUSR
  1034. #define SHM_W S_IWUSR
  1035. #include <sys/time.h>
  1036. #include <sys/types.h>
  1037. #include <sys/msg.h>
  1038. #include <sys/socket.h>
  1039. #define NET_SIZE_T size_t
  1040. #define NEED_HASHBANG_EMUL
  1041.  
  1042. #else
  1043. /* Unknown system - Edit these to match */
  1044. #ifdef BSD
  1045. #define HAVE_GMTOFF 1
  1046. #else
  1047. #undef HAVE_GMTOFF
  1048. #endif
  1049. /* NO_KILLPG is set on systems that don't have killpg */
  1050. #undef NO_KILLPG
  1051. /* NO_SETSID is set on systems that don't have setsid */
  1052. #undef NO_SETSID
  1053. /* NEED_STRDUP is set on stupid systems that don't have strdup. */
  1054. #undef NEED_STRDUP
  1055. #endif
  1056.  
  1057. #ifdef HAVE_SYS_PARAM_H
  1058. #include <sys/param.h>
  1059. #endif /* HAVE_SYS_PARAM_H */
  1060.  
  1061. /* stuff marked API_EXPORT is part of the API, and intended for use
  1062.  * by modules
  1063.  */
  1064. #ifndef API_EXPORT
  1065. #define API_EXPORT(type)    type
  1066. #endif
  1067.  
  1068. /* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
  1069.  * use by modules.  The difference between API_EXPORT and
  1070.  * API_EXPORT_NONSTD is that the latter is required for any functions
  1071.  * which use varargs or are used via indirect function call.  This
  1072.  * is to accomodate the two calling conventions in windows dlls.
  1073.  */
  1074. #ifndef API_EXPORT_NONSTD
  1075. #define API_EXPORT_NONSTD(type)    type
  1076. #endif
  1077.  
  1078. #ifndef MODULE_VAR_EXPORT
  1079. #define MODULE_VAR_EXPORT
  1080. #endif
  1081. #ifndef API_VAR_EXPORT
  1082. #define API_VAR_EXPORT
  1083. #endif
  1084.  
  1085. /* modules should not used functions marked CORE_EXPORT
  1086.  * or CORE_EXPORT_NONSTD */
  1087. #ifndef CORE_EXPORT
  1088. #define CORE_EXPORT    API_EXPORT
  1089. #endif
  1090. #ifndef CORE_EXPORT_NONSTD
  1091. #define CORE_EXPORT_NONSTD    API_EXPORT_NONSTD
  1092. #endif
  1093.  
  1094. /* On Darwin, symbols that conflict with loaded dylibs
  1095.  * (eg. System framework) need to be declared as private symbols with
  1096.  * __private_extern__.
  1097.  * For other systems, make that a no-op.
  1098.  */
  1099. #if defined(DARWIN) && defined(__DYNAMIC__)
  1100. #define ap_private_extern __private_extern__
  1101. #else
  1102. #define ap_private_extern
  1103. #endif
  1104.  
  1105. /*
  1106.  * The particular directory style your system supports. If you have dirent.h
  1107.  * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include 
  1108.  * that file and define DIR_TYPE to be dirent. Otherwise, if you have 
  1109.  * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
  1110.  * file. If you have neither, I'm confused.
  1111.  */
  1112.  
  1113. #ifndef NETWARE
  1114. #include <sys/types.h>
  1115. #endif
  1116. #include <stdarg.h>
  1117.  
  1118. #if !defined(NEXT) && !defined(WIN32)
  1119. #include <dirent.h>
  1120. #define DIR_TYPE dirent
  1121. #elif !defined(WIN32)
  1122. #include <sys/dir.h>
  1123. #define DIR_TYPE direct
  1124. #else
  1125. #define DIR_TYPE dirent
  1126. #endif
  1127.  
  1128. #include <stdio.h>
  1129. #include <stdlib.h>
  1130. #include <string.h>
  1131. #ifdef __TANDEM
  1132. #include <strings.h>
  1133. #endif
  1134. #include "ap_ctype.h"
  1135. #if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) && !defined(NETWARE)
  1136. #include <sys/file.h>
  1137. #endif
  1138. #if !defined(WIN32) && !defined(NETWARE)
  1139. #include <sys/socket.h>
  1140. #ifdef HAVE_SYS_SELECT_H
  1141. #include <sys/select.h>
  1142. #endif /* HAVE_SYS_SELECT_H */
  1143. #ifndef TPF
  1144. #include <netinet/in.h>
  1145. #endif /* TPF */
  1146. #if defined(OS390) && !defined(NO_ADDRESS)
  1147. #define NO_ADDRESS NO_DATA  /* Not defined properly by OS/390 v1r2 */
  1148. #endif
  1149. #include <netdb.h>
  1150. #include <sys/ioctl.h>
  1151. #if !defined(MPE) && !defined(BEOS) && !defined(TPF)
  1152. #include <arpa/inet.h>        /* for inet_ntoa */
  1153. #endif
  1154. #include <sys/wait.h>
  1155. #include <pwd.h>
  1156. #include <grp.h>
  1157. #include <fcntl.h>
  1158. #ifndef BEOS
  1159. #define closesocket(s) close(s)
  1160. #endif
  1161. #ifndef O_BINARY
  1162. #define O_BINARY (0)
  1163. #endif
  1164. #endif /* ndef WIN32 */
  1165.  
  1166. #include <limits.h>
  1167. #include <time.h>        /* for ctime */
  1168. #ifdef WIN32
  1169. #define strftime(s,max,format,tm)  os_strftime(s,max,format,tm)
  1170. #endif
  1171. #include <signal.h>
  1172. #ifdef NETWARE
  1173. #undef SIGKILL
  1174. #undef SA_NOCLDSTOP
  1175. #undef SIGALRM
  1176. #undef SIGCHILD
  1177. #undef SIGCONT
  1178. #undef SIGHUP
  1179. #undef SIGPIPE
  1180. #undef SIGQUIT
  1181. #undef SIGSTOP
  1182. #undef SIGTSTP
  1183. #undef SIGTTIN
  1184. #undef SIGTTOU
  1185. #undef SIGUSR1
  1186. #undef SIGUSR2
  1187. #undef SIG_BLOCK
  1188. #undef SIG_SETMASK
  1189. #undef SIG_UNBLOCK
  1190. #endif
  1191. #if defined(TPF) && defined(NSIG)
  1192. #undef NSIG
  1193. #endif
  1194. #include <errno.h>
  1195. #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) && !defined(NETWARE) && !defined(MPE)
  1196. #include <memory.h>
  1197. #endif
  1198.  
  1199. #ifdef NEED_PROCESS_H
  1200. #include <process.h>
  1201. #endif
  1202.  
  1203. #if defined(WIN32) || defined(USE_HSREGEX)
  1204. #include "hsregex.h"
  1205. #else
  1206. #include <regex.h>
  1207. #endif
  1208.  
  1209. #ifdef HAVE_SYS_RESOURCE_H
  1210. #include <sys/resource.h>
  1211. #ifdef SUNOS4
  1212. int getrlimit(int, struct rlimit *);
  1213. int setrlimit(int, struct rlimit *);
  1214. #endif
  1215. #endif
  1216. #ifdef USE_MMAP_SCOREBOARD
  1217. #if !defined(OS2) && !defined(WIN32)
  1218. /* This file is not needed for OS/2 */
  1219. #include <sys/mman.h>
  1220. #endif
  1221. #endif
  1222. #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
  1223. #define MAP_ANON MAP_ANONYMOUS
  1224. #endif
  1225.  
  1226. #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
  1227. #undef USE_MMAP_FILES
  1228. #endif
  1229.  
  1230. #if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
  1231. #undef USE_MMAP_SCOREBOARD
  1232. #endif
  1233.  
  1234. #if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
  1235. #undef USE_SHMGET_SCOREBOARD
  1236. #endif
  1237.  
  1238. #ifndef LOGNAME_MAX
  1239. #define LOGNAME_MAX 25
  1240. #endif
  1241.  
  1242. #ifdef HAVE_UNISTD_H
  1243. #include <unistd.h>
  1244. #endif
  1245.  
  1246. #ifdef ultrix
  1247. #define ULTRIX_BRAIN_DEATH
  1248. #endif
  1249.  
  1250. #ifndef S_ISLNK
  1251. #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  1252. #endif
  1253.  
  1254. #ifndef INADDR_NONE
  1255. #define INADDR_NONE ((unsigned long) -1)
  1256. #endif
  1257.  
  1258. /*
  1259.  * Replace signal function with sigaction equivalent
  1260.  */
  1261. #ifndef NO_USE_SIGACTION
  1262. typedef void Sigfunc(int);
  1263.  
  1264. #if defined(SIG_IGN) && !defined(SIG_ERR)
  1265. #define SIG_ERR ((Sigfunc *)-1)
  1266. #endif
  1267.  
  1268. /*
  1269.  * For some strange reason, QNX defines signal to signal. Eliminate it.
  1270.  */
  1271. #ifdef signal
  1272. #undef signal
  1273. #endif
  1274. #define signal(s,f)    ap_signal(s,f)
  1275. Sigfunc *signal(int signo, Sigfunc * func);
  1276. #endif
  1277.  
  1278. #include <setjmp.h>
  1279.  
  1280. #if defined(USE_LONGJMP)
  1281. #define ap_longjmp(x, y)        longjmp((x), (y))
  1282. #define ap_setjmp(x)            setjmp(x)
  1283. #ifndef JMP_BUF
  1284. #define JMP_BUF jmp_buf
  1285. #endif
  1286. #else
  1287. #define ap_longjmp(x, y)        siglongjmp((x), (y))
  1288. #define ap_setjmp(x)            sigsetjmp((x), 1)
  1289. #ifndef JMP_BUF
  1290. #define JMP_BUF sigjmp_buf
  1291. #endif
  1292. #endif
  1293.  
  1294. /* Majority of os's want to verify FD_SETSIZE */
  1295. #if !defined(WIN32) && !defined(TPF) && !defined(NETWARE)
  1296. #define CHECK_FD_SETSIZE
  1297. #endif
  1298.  
  1299. #ifdef USE_TPF_SELECT
  1300. #define ap_select(_a, _b, _c, _d, _e)    \
  1301.     tpf_select(_a, _b, _c, _d, _e)
  1302. #elif defined(SELECT_NEEDS_CAST)
  1303. #define ap_select(_a, _b, _c, _d, _e)   \
  1304.     select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
  1305. #else
  1306. #define ap_select(_a, _b, _c, _d, _e)   \
  1307.     select(_a, _b, _c, _d, _e)
  1308. #endif
  1309.  
  1310. #ifdef USE_TPF_ACCEPT
  1311. #define ap_accept(_fd, _sa, _ln)    tpf_accept(_fd, _sa, _ln)
  1312. #else
  1313. #define ap_accept(_fd, _sa, _ln)    accept(_fd, _sa, _ln)
  1314. #endif
  1315.  
  1316. #ifdef NEED_SIGNAL_INTERRUPT
  1317. #define ap_check_signals()    tpf_process_signals()
  1318. #else
  1319. #define ap_check_signals()
  1320. #endif
  1321.  
  1322. #ifdef ULTRIX_BRAIN_DEATH
  1323. #define ap_fdopen(d,m) fdopen((d), (char *)(m))
  1324. #else
  1325. #define ap_fdopen(d,m) fdopen((d), (m))
  1326. #endif
  1327.  
  1328. #ifndef ap_inet_addr
  1329. #define ap_inet_addr inet_addr
  1330. #endif
  1331.  
  1332. #ifdef NO_OTHER_CHILD
  1333. #define NO_RELIABLE_PIPED_LOGS
  1334. #endif
  1335.  
  1336. /* When the underlying OS doesn't support exec() of scripts which start
  1337.  * with a HASHBANG (#!) followed by interpreter name and args, define this.
  1338.  */
  1339. #ifdef NEED_HASHBANG_EMUL
  1340. extern int ap_execle(const char *filename, const char *arg,...);
  1341. extern int ap_execve(const char *filename, char * const argv[],
  1342.                      char * const envp[]);
  1343. /* ap_execle() is a wrapper function around ap_execve(). */
  1344. #define execle  ap_execle
  1345. #define execve(path,argv,envp)  ap_execve(path,argv,envp)
  1346. #endif
  1347.  
  1348. /* Finding offsets of elements within structures.
  1349.  * Taken from the X code... they've sweated portability of this stuff
  1350.  * so we don't have to.  Sigh...
  1351.  */
  1352.  
  1353. #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
  1354. #ifdef __STDC__
  1355. #define XtOffset(p_type,field) _Offsetof(p_type,field)
  1356. #else
  1357. #ifdef CRAY2
  1358. #define XtOffset(p_type,field) \
  1359.     (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
  1360.  
  1361. #else /* !CRAY2 */
  1362.  
  1363. #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
  1364.  
  1365. #endif /* !CRAY2 */
  1366. #endif /* __STDC__ */
  1367. #else /* ! (CRAY || __arm) */
  1368.  
  1369. #define XtOffset(p_type,field) \
  1370.     ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
  1371.  
  1372. #endif /* !CRAY */
  1373.  
  1374. #ifdef offsetof
  1375. #define XtOffsetOf(s_type,field) offsetof(s_type,field)
  1376. #else
  1377. #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
  1378. #endif
  1379.  
  1380. /*
  1381.  * NET_SIZE_T exists because of shortsightedness on the POSIX committee.  BSD
  1382.  * systems used "int *" as the parameter to accept(), getsockname(),
  1383.  * getpeername() et al.  Consequently many unixes took an int * for that
  1384.  * parameter.  The POSIX committee decided that "int" was just too generic and
  1385.  * had to be replaced with size_t almost everywhere.  There's no problem with
  1386.  * that when you're passing by value.  But when you're passing by reference
  1387.  * this creates a gross source incompatibility with existing programs.  On
  1388.  * 32-bit architectures it creates only a warning.  On 64-bit architectures it
  1389.  * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
  1390.  * "size_t *" is frequently a pointer to a 32-bit quantity.
  1391.  *
  1392.  * Some Unixes adopted "size_t *" for the sake of POSIX compliance.  Others
  1393.  * ignored it because it was such a broken interface.  Chaos ensued.  POSIX
  1394.  * finally woke up and decided that it was wrong and created a new type
  1395.  * socklen_t.  The only useful value for socklen_t is int, and that's how
  1396.  * everyone who has a clue implements it.  It is almost always the case that
  1397.  * NET_SIZE_T should be defined to be an int, unless the system being compiled
  1398.  * for was created in the window of POSIX madness.
  1399.  */
  1400. #ifndef NET_SIZE_T
  1401. #define NET_SIZE_T int
  1402. #endif
  1403.  
  1404. /* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
  1405.  * is in use... we'd prefer to just use WCOREDUMP everywhere.
  1406.  */
  1407. #if defined(__WCOREDUMP) && !defined(WCOREDUMP)
  1408. #define WCOREDUMP __WCOREDUMP
  1409. #endif
  1410.  
  1411. #ifdef SUNOS_LIB_PROTOTYPES
  1412. /* Prototypes needed to get a clean compile with gcc -Wall.
  1413.  * Believe it or not, these do have to be declared, at least on SunOS,
  1414.  * because they aren't mentioned in the relevant system headers.
  1415.  * Sun Quality Software.  Gotta love it.  This section is not 
  1416.  * currently (13Nov97) used.
  1417.  */
  1418.  
  1419. int getopt(int, char **, char *);
  1420.  
  1421. int strcasecmp(const char *, const char *);
  1422. int strncasecmp(const char *, const char *, int);
  1423. int toupper(int);
  1424. int tolower(int);
  1425.  
  1426. int printf(char *,...);
  1427. int fprintf(FILE *, char *,...);
  1428. int fputs(char *, FILE *);
  1429. int fread(char *, int, int, FILE *);
  1430. int fwrite(char *, int, int, FILE *);
  1431. int fgetc(FILE *);
  1432. char *fgets(char *s, int, FILE*);
  1433. int fflush(FILE *);
  1434. int fclose(FILE *);
  1435. int ungetc(int, FILE *);
  1436. int _filbuf(FILE *);    /* !!! */
  1437. int _flsbuf(unsigned char, FILE *);    /* !!! */
  1438. int sscanf(char *, char *,...);
  1439. void setbuf(FILE *, char *);
  1440. void perror(char *);
  1441.  
  1442. time_t time(time_t *);
  1443. int strftime(char *, int, const char *, struct tm *);
  1444.  
  1445. int initgroups(char *, int);
  1446. int wait3(int *, int, void *);    /* Close enough for us... */
  1447. int lstat(const char *, struct stat *);
  1448. int stat(const char *, struct stat *);
  1449. int flock(int, int);
  1450. #ifndef NO_KILLPG
  1451. int killpg(int, int);
  1452. #endif
  1453. int socket(int, int, int);
  1454. int setsockopt(int, int, int, const char *, int);
  1455. int listen(int, int);
  1456. int bind(int, struct sockaddr *, int);
  1457. int connect(int, struct sockaddr *, int);
  1458. int accept(int, struct sockaddr *, int *);
  1459. int shutdown(int, int);
  1460.  
  1461. int getsockname(int s, struct sockaddr *name, int *namelen);
  1462. int getpeername(int s, struct sockaddr *name, int *namelen);
  1463. int gethostname(char *name, int namelen);
  1464. void syslog(int, char *,...);
  1465. char *mktemp(char *);
  1466.  
  1467. int vfprintf(FILE *, const char *, va_list);
  1468.  
  1469. #endif /* SUNOS_LIB_PROTOTYPES */
  1470.  
  1471. /* The assumption is that when the functions are missing,
  1472.  * then there's no matching prototype available either.
  1473.  * Declare what is needed exactly as the replacement routines implement it.
  1474.  */
  1475. #ifdef NEED_STRDUP
  1476. extern char *strdup (const char *str);
  1477. #endif
  1478. #ifdef NEED_STRCASECMP
  1479. extern int strcasecmp (const char *a, const char *b);
  1480. #endif
  1481. #ifdef NEED_STRNCASECMP
  1482. extern int strncasecmp (const char *a, const char *b, int n);
  1483. #endif
  1484. #ifdef NEED_INITGROUPS
  1485. extern int initgroups(const char *name, gid_t basegid);
  1486. #endif
  1487. #ifdef NEED_WAITPID
  1488. extern int waitpid(pid_t pid, int *statusp, int options);
  1489. #endif
  1490. #ifdef NEED_STRERROR
  1491. extern char *strerror (int err);
  1492. #endif
  1493. #ifdef NEED_DIFFTIME
  1494. extern double difftime(time_t time1, time_t time0);
  1495. #endif
  1496.  
  1497. #ifndef ap_wait_t
  1498. #define ap_wait_t int
  1499. #endif
  1500.  
  1501. #ifdef __cplusplus
  1502. }
  1503. #endif
  1504.  
  1505. #endif /* !AP_CONFIG_H */
  1506.